(defun fact (x)
  (if (< x 1) 1
      (* x (fact (1- x)))))

(defun fact-digits (n)
  (if (< n 10) (fact n)
      (+ (fact (mod n 10)) (fact-digits (floor (/ n 10))))))

(defun curios (n)
  (= n (fact-digits n)))

(defun probl34 ()
  (reduce #'+ (loop for i from 10 to 100000 when (curios i) collect i)))